package com.test;

import java.util.HashMap;
import java.util.Scanner;

public class test {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		String s = sc.next();
		countStr(str,s);
	}
	public  static  void countStr(String str ,String s){
		HashMap<Character , Integer> map = new HashMap<>();
		char char1[] = str.toCharArray();
		for(char c : char1){
			if(!map.containsKey(c))
				map.put(c, 1);
			else
				map.put(c, map.get(c)+1);
			
		}
		char char2[] = s.toCharArray();
		for(char c2 : char2){
			if(map.containsKey(c2))
				System.out.println(c2 + ":"+map.get(c2));
		}
		/*for(Character key : map.keySet()){
			System.out.println(key+":"+map.get(key));
		}*/
	}

	
}
